<%@ page import="com.suitsoft.ut.util.*" %>
<%@ page contentType="text/html;charset=UTF-8"%>
<%
    System.out.println("This is download.jsp");
	java.io.BufferedInputStream bis = null ;
	java.io.BufferedOutputStream  bos = null ;
	
	try {
        String exportFilePath = (String)request.getAttribute("exportFilePath");
    	String exportFileName = (String)request.getAttribute("exportFileName");
    	
    	//if(ZipFileUtils.zip(exportFilePath)) {
    	//	exportFilePath = exportFilePath + ".zip";
    	//	exportFileName = exportFileName + ".zip";
    	//}
    	 
    	 exportFilePath= exportFilePath + "/" +exportFileName;
 		response.setContentType("application/x-msdownload");
 		response.setHeader("Content-disposition", "attachment;filename=" 
 			+ new String (exportFileName.getBytes("GB2312"), "ISO8859-1"));
 		
 		bis = new java.io.BufferedInputStream(new java.io.FileInputStream(exportFilePath));
 		bos = new java.io.BufferedOutputStream(response.getOutputStream()); 
 		int len;
 		byte[] buff = new byte[2048];
  		while (-1 != (len = bis.read(buff))) {
  			bos.write(buff, 0, len);
 		}
  		out.clear(); 
  		out = pageContext.pushBody();    //  out.clearBuffer(); 
	} catch (IllegalStateException e) {
		
	} catch(Exception e) {
 		e.printStackTrace();
	} finally {
  		if (bis != null) bis.close();
  		if (bos != null) bos.close();
	}
%>  